import collections
class Solution(object):
    def countSubgraphsForEachDiameter(self, n, edges):
        d = collections.defaultdict(set)
        for u, v in edges:
            d[u].add(v)
            d[v].add(u)
        
        def dfs(u):
            max_ans = 0
            for v in d[u]:
                if v in now_set:
                    d[v].remove(u)
                    max_ans = max(max_ans, dfs(v) + 1)
                    d[v].add(u)
            return max_ans

        out = [0] * (n - 1)
        for val in range(2 ** n):
            num = val.bit_count()
            now_set = set()
            for u, v in edges:
                if (val >> (u - 1)) & 1 and (val >> (v - 1)) & 1:
                    now_set.add(u)
                    now_set.add(v)
                    num -= 1
            max_ans = 0
            if num == 1:
                for u in now_set:
                    max_ans = max(max_ans, dfs(u))
                if max_ans > 0:
                    out[max_ans - 1] += 1
        return out
                


data =  Solution()
n = 3
edges = [[1, 2], [2, 3]]
print(data.countSubgraphsForEachDiameter(n, edges))